﻿/* We are given a string containing a list of forbidden words and a text containing some 
 * of these words. Write a program that replaces the forbidden words with asterisks. Example:
Microsoft announced its next generation PHP compiler today. It is based on .NET framework 4.0
and is implemented as a dynamic language in CLR.
 
Words: PHP, CLR, Microsoft
The expected result:
*** announaced its next generation *** compiler today. It is based on the .NET framework 4.0
and is implemented as a dynamic language in ***.
 */
using System;

namespace _9.ForbiddenWords
{
    class ForbiddenWords
    {
        static void Main()
        {
            Console.WriteLine("Text: ");
            string text = Console.ReadLine();
            //string text = @"Microsoft announced its next generation PHP compiler today. It is based on .NET framework 4.0 and is implemented as a dynamic language in CLR.";
            
            //define forbidden words here
            string[] forbiddenwords = { "PHP", "CLR", "Microsoft" };

            string newtext = text;

            foreach (string currword in forbiddenwords)
            {
                string censored = "".PadLeft(currword.Length, '*');
                newtext = newtext.Replace(currword, censored);
            }
            Console.WriteLine(newtext);
        }
    }
}
